#ifndef INSTRUMENT_BACKGROUND_H
#define INSTRUMENT_BACKGROUND_H
#include <map>
#include <vector>

#include "MLFrame.h"
#include "MLObj.h"
#include "Stream.h"

#include "Drawer.h"

class _InstrumentFan {
public:
	_InstrumentFan(
		VelocityStream& velocity_stream,
		int frame_size_x, int frame_size_y,
		size_t instruments_total_num,
		size_t instrument_index,
		Byte color_r,
		Byte color_g,
		Byte color_b,
		Byte alpha,
		GLuint glsl,
		GLuint mix_glsl,
		double brightness,
		double light_extension,
		int record_radius
	);
	void get_frame(size_t frame_index, MLFrame& frame);

private:
	int _frame_size_x, _frame_size_y;
	VelocityStream _stream;
	double _max_brightness_value;

	Sector _sector;
	GLuint _glsl;
	GLuint _mix_glsl;

	int _radius;
	double _start_angle;
	double _end_angle;
	int _center_x;
	int _center_y;

	Byte _color_r;
	Byte _color_g;
	Byte _color_b;

	int _start_radius;
};

class InstrumentBackground :public MLObj {
public:
	InstrumentBackground(
		std::vector<VelocityStream>& velocity_streams,
		int frame_size_x, int frame_size_y,
		double frame_rate,
		std::map<std::string, Color>& colors,
		Byte alpha,
		double light_extension,
		double min_light_extension_angle,
		double brightness,
		int record_radius
	);
	void get_frame(size_t frame_index, MLFrame& frame);

private:
	std::vector<_InstrumentFan> _instrument_fans;
	GLuint _mix_glsl;
	GaussianBlurKernel _blur_kernel;
};
#endif
